home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / adddosentry.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  86 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: adddosentry.c,v 1.3 1996/08/13 13:52:44 digulla Exp $
  4.     $Log: adddosentry.c,v $
  5.     Revision 1.3  1996/08/13 13:52:44  digulla
  6.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  7.     Replaced __AROS_LA by __AROS_LHA
  8.  
  9.     Revision 1.2  1996/08/01 17:40:47  digulla
  10.     Added standard header for all files
  11.  
  12.     Desc:
  13.     Lang: english
  14. */
  15. #include <dos/dosextens.h>
  16. #include <clib/utility_protos.h>
  17.  
  18. /*****************************************************************************
  19.  
  20.     NAME */
  21.     #include <clib/dos_protos.h>
  22.  
  23.     __AROS_LH1(LONG, AddDosEntry,
  24.  
  25. /*  SYNOPSIS */
  26.     __AROS_LHA(struct DosList *, dlist, D1),
  27.  
  28. /*  LOCATION */
  29.     struct DosLibrary *, DOSBase, 113, Dos)
  30.  
  31. /*  FUNCTION
  32.     Adds a given dos list entry to the dos list. Automatically
  33.     locks the list for writing. There may be not more than one device
  34.     or assign node of the same name. There are no restrictions on
  35.     volume nodes.
  36.  
  37.     INPUTS
  38.     dlist - pointer to dos list entry.
  39.  
  40.     RESULT
  41.     !=0 if all went well, 0 otherwise.
  42.  
  43.     NOTES
  44.     Since anybody who wants to use a device or volume node in the
  45.     dos list has to lock the list, filesystems may be called with
  46.     the dos list locked. So if you want to add a dos list entry
  47.     out of a filesystem don't just wait on the lock but serve all
  48.     incoming requests until the dos list is free instead.
  49.  
  50.     EXAMPLE
  51.  
  52.     BUGS
  53.  
  54.     SEE ALSO
  55.  
  56.     INTERNALS
  57.  
  58.     HISTORY
  59.     29-10-95    digulla automatically created from
  60.                 dos_lib.fd and clib/dos_protos.h
  61.  
  62. *****************************************************************************/
  63. {
  64.     __AROS_FUNC_INIT
  65.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  66.     LONG success=1;
  67.     struct DosList *dl;
  68.  
  69.     dl=LockDosList(LDF_ALL|LDF_WRITE);
  70.     if(dlist->dol_Type!=DLT_VOLUME)
  71.     {
  72.     dl=FindDosEntry(dl,dlist->dol_Name,LDF_DEVICES|LDF_ASSIGNS|LDF_WRITE);
  73.     if(dl!=NULL)
  74.         success=0;
  75.     }
  76.     if(success)
  77.     {
  78.     dlist->dol_Next=DOSBase->dl_DevInfo;
  79.     DOSBase->dl_DevInfo=dlist;
  80.     }
  81.     UnLockDosList(LDF_ALL|LDF_WRITE);
  82.  
  83.     return success;    
  84.     __AROS_FUNC_EXIT
  85. } /* AddDosEntry */
  86.